package com.yifi.common;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.jfinal.plugin.activerecord.Record;

public class RecordToMap {

	public static Map ReToMap(Record rec) {
		Map dataMap = new HashMap();
		String[] columns = rec.getColumnNames();
		for (int i = 0; i < rec.getColumnNames().length; i++) {
			String column = columns[i];
			String Str = (rec.get(column) == null) ? "" : rec.get(column).toString();
			dataMap.put(column, Str);
		}
		return dataMap;
	}
	
	public static Record Together(Record pRecord,Record chRecord)
	{
		String[] columns = chRecord.getColumnNames();
		for (int i = 0; i < chRecord.getColumnNames().length; i++) {
			String column = columns[i];
			String Str = (chRecord.get(column) == null) ? "" : chRecord.get(column).toString();
			pRecord.set(column, Str);
		}
		return pRecord;
	}
}
